// Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package dfa.axis.v1_19.matchtables;

import com.google.api.ads.dfa.axis.v1_19.ApiException;
import com.google.api.ads.dfa.axis.v1_19.Base;
import com.google.api.ads.dfa.axis.v1_19.PageableSearchCriteriaBase;

import java.rmi.RemoteException;
import java.util.List;

/**
 * Callback class for clients of SoapPageableLookup that knows how to do SOAP lookups for a
 * specific entity type. Exposes Criteria object so that SoapPageableLookup class can set the page
 * number correctly.
 *
 * @author Moshe Kahan
 */
interface SoapPageableLookupCallback<Record extends Base,
  Criteria extends PageableSearchCriteriaBase> {

  /**
   * Returns records associated with array of entity IDs.
   * @param criteria PageableSearchCriteriaBase returned from getCriteria.
   * @param recordList adds all entities retrieved from DFA SOAP API to this list
   * @return the number of pages returned from SOAP lookup.
   */
  int getRecords(Criteria criteria, List<Record> recordList) throws ApiException, RemoteException;

  /**
   * Creates a PageableSearchCriteriaBase associated with this entity SOAP request.
   * @return Criteria object of type PageableSearchCriteriaBase.
   */
  Criteria getCriteria();
}
